#!/usr/bin/env bash

# -------------------- 安装docker --------------------------
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
yum makecache fast
yum -y install docker-ce
systemctl start docker

# -------------------- 安装kubectl --------------------------
# 安装kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
# 授权
chmod +x ./kubectl
# 安装
mv ./kubectl /usr/local/bin/kubectl

# -------------------- 安装minikube --------------------------
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
  && chmod +x minikube
cp minikube /usr/local/bin && rm minikube
echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
yum install conntrack -y
minikube start --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers --vm-driver=none
# 小于一核的用这个
# minikube start --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers --vm-driver=none --extra-config=kubeadm.ignore-preflight-errors=NumCPU --force --cpus 1
